# Maintainer: Alexey Pavlov <Alexpux@gmail.com>

pkgname=zip
pkgver=3.0
_pkgver=30
pkgrel=2
pkgdesc="Creates PKZIP-compatible .zip files"
arch=('i686' 'x86_64')
url="http://www.info-zip.org/Zip.html"
license=('BSD')
depends=('libbz2')
options=('!makeflags')
groups=('compression')
source=("ftp://ftp.info-zip.org/pub/infozip/src/${pkgname}${_pkgver}.zip"
        'zip-3.0-11.src.patch'
        'zip-3.0-build.patch')
md5sums=('e88492c8abd68fa9cfba72bc08757dba'
         'd52cb016b3c9dfb69eb292992bb5c6f0'
         'bc878d9aa48efb540538d33843650e74')

prepare() {
   cd "${srcdir}/${pkgname}${_pkgver}"
   patch -p2 -i ${srcdir}/zip-3.0-11.src.patch
   patch -p1 -i ${srcdir}/zip-3.0-build.patch
}

build() {
   cd "${srcdir}/${pkgname}${_pkgver}"
   make -f unix/Makefile cygwin LOCAL_ZIP="$CFLAGS -DFORCE_UNIX_OVER_WIN32" prefix=/usr
}

package() {
   cd "${srcdir}/${pkgname}${_pkgver}"
   make -f unix/Makefile prefix=${pkgdir}/usr \
     MANDIR=${pkgdir}/usr/share/man/man1 E=.exe install
   install -D -m644 LICENSE ${pkgdir}/usr/share/licenses/$pkgname/LICENSE
}
